﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using AMatysiak.Methods;
using System;

namespace AMatysiakTest.Methods
{
    [TestClass]
    public class IsValidEmailAddressTest
    {
        [TestMethod]
        public void emptyMail()
        {
            bool valid = "".IsValidEmailAddress();
            Assert.IsFalse(valid);
        }

        [TestMethod]
        public void onlyUserAccount()
        {
            bool valid = "adam.matysiak".IsValidEmailAddress();
            Assert.IsFalse(valid);
        }

        [TestMethod]
        public void toAt()
        {
            bool valid = "adam.matysiak@".IsValidEmailAddress();
            Assert.IsFalse(valid);
        }

        [TestMethod]
        public void withoutExtension()
        {
            bool valid = "adam.matysiak@gmail".IsValidEmailAddress();
            Assert.IsFalse(valid);
        }

        [TestMethod]
        public void withoutCountryCode()
        {
            bool valid = "adam.matysiak@gmail.".IsValidEmailAddress();
            Assert.IsFalse(valid);
        }

        [TestMethod]
        public void withoutDomain()
        {
            bool valid = "adam.matysiak@com".IsValidEmailAddress();
            Assert.IsFalse(valid);
        }

        [TestMethod]
        public void singleCountryCode()
        {
            bool valid = "adam.matysiak@gmail.c".IsValidEmailAddress();
            Assert.IsFalse(valid);
        }

        [TestMethod]
        public void withoutUserAccount()
        {
            bool valid = "@gmail.com".IsValidEmailAddress();
            Assert.IsFalse(valid);
        }

        [TestMethod]
        public void validEmail()
        {
            bool valid = "adam.matysiak@gmail.com".IsValidEmailAddress();
            Assert.IsTrue(valid);
        }

        [TestMethod]
        public void safeAt()
        {
            bool valid = "adam.matysiak[at]gmail.com".IsValidEmailAddress();
            Assert.IsTrue(valid);
        }
    }
}
